#!/usr/bin/perl
use strict;
use warnings; 

#MoTDStats is released under the MIT License, a copy is provided in the INFO file.
#Remember, this isn't Currys or Comet, there's no warranty (Extended or otherwise) available for this code, no matter how much money you want to pay, or however you plead/kick, scream and shout ;)

#This is version 0.0.0a (Initial Public Release).

#Change these settings to suit, comments are provided next to each option you can change.
my $ColourPrinting = 1; # 1 turns username/date banner colour on, 0 turns it off 
my $DFPlatform = "Autodetect"; #Setting this to Autodetect will in most cases display the correct info for your system using some very nasty autodetect code. If the formatting looks wrong for your system, you can override this as usual.
my $DFNode="sd"; #sd or hd for Linux, da or ad for FreeBSD, disk for Darwin

#These are for internal use only, do not modify them!
my $uname=`uname -sm`; #I've yet to find a platform this doesn't work on.
my $username=`echo -n \$USER`; #Works with bash and dash. 
my $date=`date`;



sub UNAME {
    print "You're running on $uname\n";
}

sub UserDate {
    if ($ColourPrinting == 1) {
    use Term::ANSIColor qw(:constants);
    $Term::ANSIColor::AUTORESET = 1;
    print WHITE ON_BLUE "Currently logged in as $username. Today is $date";
}

   if ($ColourPrinting == 0) {
   print "Currently logged in as $username. Today is $date";
} 
   print "\n";
}

sub DiskFree {

my $Auto=`uname -s`;
my $GNUdf_hOut="Filesystem            Size  Used Avail Use% Mounted on\n";

    if ($DFPlatform eq "Autodetect") {
    if ($Auto eq "$Auto") {
    my $DiskFreeInfo_sd=`df -h | grep $DFNode`;
    print "$GNUdf_hOut";
    print "$DiskFreeInfo_sd\n";
 }

}
#Versions with platform specific requirements go inside here...
}
UserDate();
UNAME();
DiskFree();
